'use strict';
const db = uniCloud.database()
exports.main = async ({action,params}, context) => {
	
	let res =null;
	if(action=="addGarbageType"){
		const collection = db.collection('garbageType')
		res = await collection.add(params)
	}if(action=="addGarbageTypeDesc"){
		const collection = db.collection('garbageTypeDesc')
		res = await collection.add(params)
	}else if(action=="getGarbageType"){
		const collection = db.collection('garbageType')
		res = await collection.get()
	}else if(action=="getGarbageTypeDesc"){
		const collection = db.collection('garbageTypeDesc')
		res = await collection.where({id:params.id}).get()
	}
	return res
};